function z = e_rb(x)
%Extended Rosenbrock function
%n variable but even,m=n,x0=[-1.2,1,...,-1.2,1]
%fmin1=0 at [1,1,...,1]
%Author:Ji Lin
n=length(x);
m=n;
% for ii=1:n/2
%     x(2*ii-1)=-1.2;
%     x(2*ii)=1;
% end
z=ones(1,m);
for ii=1:n/2
    z(2*ii-1)=10*(x(2*ii)-x(2*ii-1)^2);
    z(2*ii)=1-x(2*ii-1);
end
z=sum(z.^2);